# Maintainer: Morten Linderud <foxboron@archlinux.org>
# Maintainer: Jonas Witschel <diabonas@archlinux.org>
# Contributor: Maxim Baz <$pkgname at maximbaz dot com>
# Contributor: Alexis "Horgix" Chotard <alexis.horgix.chotard@gmail.com>
# Contributor: carstene1ns <arch carsten-teibes de> - http://git.io/ctPKG

pkgname=py3status
pkgver=3.50
pkgrel=1
pkgdesc="An extensible i3status replacement/wrapper written in python"
url="https://www.ultrabug.fr/tag/py3status/"
arch=('any')
license=('BSD')
depends=('python' 'python-setuptools')
makedepends=('python-build' 'python-installer' 'python-wheel')
checkdepends=('python-pytest')
optdepends=('i3status: for i3status modules'
            'i3blocks: for i3blocks modules'
            'iw: for the wifi module'
            'python-mpris2: for the mpris module'
            'python-pyudev: for udev event monitoring'
            'python-pydbus: for modules that rely on D-Bus'
            'python-pytz: for the clock module'
            'python-tzlocal: for the clock module'
            'pacman-contrib: for the arch_updates module')
source=("$pkgname-$pkgver.tar.gz::https://github.com/ultrabug/py3status/archive/refs/tags/$pkgver.tar.gz")
sha256sums=('092574de6247574e21ebe516b8f62eba230420da276b4ee51726e12c52d05095')

build() {
    cd "$pkgname-$pkgver"
    python -m build --wheel --no-isolation
}

check() {
    cd "$pkgname-$pkgver"
    pytest
}

package() {
    cd "$pkgname-$pkgver"
    python -m installer --destdir="$pkgdir" dist/*.whl
    install -d "$pkgdir/usr/share/doc/$pkgname"{,/dev-guide,/user-guide}
    install -m644 docs/*.md README.md CHANGELOG "$pkgdir/usr/share/doc/$pkgname"
    install -m644 docs/dev-guide/* "$pkgdir/usr/share/doc/$pkgname/dev-guide"
    install -m644 docs/user-guide/* "$pkgdir/usr/share/doc/$pkgname/user-guide"
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
